package com.liu.controller;


import com.liu.Utils.JsonData;
import com.liu.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/user")
public class IndexController {

    @Autowired
    private UserService userService;

    @PostMapping( "/my")
    @ResponseBody
    public JsonData myImport(@RequestParam("file") MultipartFile file){

        JsonData jsonData = userService.insert(file);
        if (jsonData.getCode() == 0){
            return JsonData.buildSuccess();
        }else {
            return JsonData.buildError("失败");
        }
    }

}
